import Vue from 'vue'
import VueRouter from 'vue-router'
// import studentRouters from './route/student.routes'
import teachRoutes from './route/teacher.routes'
Vue.use(VueRouter)
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  // routes: studentRouters,
  routes: teachRoutes,
})
router.beforeEach((to, from, next) => {
  // document.body.scrollTop = 0
  // document.documentElement.scrollTop = 0
  // window.pageYOffset = 0
  next()
})
/* 禁止全局路由错误处理打印 */
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}

export default router